package edu.gdut.tiantian.service.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;

import edu.gdut.tiantian.dao.UserDao;
import edu.gdut.tiantian.entity.User;
import edu.gdut.tiantian.service.IUserService;
@Service
public class UserService implements IUserService {
	
	@Autowired
	private UserDao userDao;
	
	@Override
	public User userLogin(String username, String password) {
		return userDao.userLogin(username, password);
	}

	@Override
	public void save(User user) {
		userDao.save(user);
	}

	@Override
	public void updateUser(User user) {
		userDao.updateUser(user);
	}

	@Override
	public User findByUsername(String username) {
		return userDao.findByUsername(username);
	}

	@Override
	public void updateStatus(String userId,Integer status) {
		userDao.updateStatus(userId,status);
	}

	@Override
	public User findById(String userId) {
		return userDao.findById(userId);
	}

	@Override
	public User getUser(String userId) {
		return userDao.getUser(userId);
	}

	@Override
	public List<User> findByCondition(Map<String, String> condition, int pageNum) {
		PageHelper.startPage(pageNum, 5);
		return userDao.findByCondition(condition);
	}

}
